package tests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import coreSimulation.Baggage;

/*
 * Test the IllegalStateException thrown by the constructor of the Baggage class
 * using different illegal dimensions
 */
public class BaggageTest {

	Baggage b;

	/*
	 * test exception for width too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidWidth() {
		b = new Baggage(0, 1, 1, 1);

	}

	/*
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidHeight() {
		b = new Baggage(1, 0, 1, 1);

	}

	/*
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidDepth() {
		b = new Baggage(1, 1, 0, 1); // width too small

	}

	/*
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageWeightTooSmall() {
		b = new Baggage(1, 1, 1, 0); // weight too small

	}

	/*
	 * Test getWidth() method
	 */
	@Test
	public void testGetWidth() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 10, b.getWidth());
	}

	/*
	 * Test getHeight() method
	 */
	@Test
	public void testGetHeight() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 15, b.getHeight());
	}

	/*
	 * Test getDepth() method
	 */
	@Test
	public void testGetDepth() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 20, b.getDepth());
	}

	/*
	 * Test getWeight() method
	 */
	@Test
	public void testGetWeight() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 25.1, b.getWeight(), 0);
	}

}
